package Lenguaje;

public class Token {

	public enum Label {
		EOF,RESERVADA,SIMBOLO,IDENTIFICADOR,SPACE,ERROR,NEWLINE
	};

	Label thislabel;	
	int thisline;
	int thiscol;
	Object thisval;

	public Token(Label t,int l,int c) {
		thislabel = t;
		thisline = l;
		thiscol = c;
		thisval = null;
	}
	
	public Token(Label t,int l,int c,Object v) {
		thislabel = t;
		thisline = l;
		thiscol = c;
		thisval=v;
	}

	public Token(Label t) {
		thislabel = t;
		thisline = -1;
		thiscol = -1;
		thisval = null;
	}
	
	public String toString() {
		switch(thislabel) {
		case EOF: return "";
		case SPACE: return " ";
		case RESERVADA: return thisval.toString();
		case SIMBOLO: return thisval.toString();
		case IDENTIFICADOR: return thisval.toString();
		case ERROR: return thisval.toString();
		case NEWLINE: return "\n";
		}
		return "<<invalid token>>";
	}
}